/* 无障碍样式文件 */
/* 定义高对比度模式、焦点样式和键盘导航样式 */

/* 导入主题配置 */
@import './themeConfig';

/* 无障碍混入工具 */
@mixin focus-visible($outline-color: $primary-color, $outline-width: 3px, $outline-offset: 2px) {
  &:focus-visible,
  &.focus-visible {
    outline: $outline-width solid $outline-color;
    outline-offset: $outline-offset;
    box-shadow: 0 0 0 $outline-width rgba($outline-color, 0.2);
    transition: outline-offset 0.2s ease, box-shadow 0.2s ease;
    
    &:hover {
      outline-offset: $outline-offset + 1px;
      box-shadow: 0 0 0 ($outline-width + 2px) rgba($outline-color, 0.3);
    }
  }
  
  // 确保所有可聚焦元素都有焦点样式
  &:focus {
    outline: none;
  }
}

@mixin high-contrast {
  // 提高颜色对比度
  color: #000000;
  background-color: #ffffff;
  
  // 链接颜色
  a {
    color: #0000ff !important;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    
    &:hover {
      color: #ff0000 !important;
      text-decoration-thickness: 3px;
    }
    
    &:focus-visible {
      color: #0000ff !important;
      background-color: #ffff00;
    }
  }
  
  // 按钮样式
  button,
  .btn {
    border: 3px solid #000000;
    color: #000000 !important;
    background-color: #cccccc !important;
    font-weight: bold;
    
    &:hover {
      background-color: #999999 !important;
    }
    
    &:active {
      background-color: #666666 !important;
    }
    
    &:disabled {
      background-color: #eeeeee !important;
      color: #999999 !important;
      border-color: #999999;
    }
    
    &:focus-visible {
      background-color: #ffff00 !important;
    }
  }
  
  // 输入框样式
  input,
  select,
  textarea {
    border: 3px solid #000000 !important;
    background-color: #ffffff !important;
    color: #000000 !important;
    
    &:focus {
      border-color: #0000ff !important;
      background-color: #ffff00 !important;
    }
    
    &:disabled {
      background-color: #eeeeee !important;
      color: #999999 !important;
      border-color: #999999 !important;
    }
  }
  
  // 表单标签
  label {
    color: #000000 !important;
    font-weight: bold;
  }
  
  // 头部和导航
  header,
  nav {
    background-color: #cccccc !important;
    border-bottom: 3px solid #000000;
  }
  
  // 卡片样式
  .card,
  .custom-card {
    border: 3px solid #000000 !important;
    background-color: #ffffff !important;
  }
  
  // 图标颜色
  .icon {
    color: #000000 !important;
  }
  
  // 表格样式
  table {
    border-collapse: collapse !important;
    border: 3px solid #000000;
    
    th,
    td {
      border: 2px solid #000000 !important;
      background-color: #ffffff !important;
      color: #000000 !important;
      padding: 12px !important;
    }
    
    th {
      background-color: #cccccc !important;
      font-weight: bold;
    }
  }
  
  // 错误状态
  .error {
    color: #ff0000 !important;
    background-color: #ffeeee !important;
    border: 3px solid #ff0000 !important;
  }
  
  // 成功状态
  .success {
    color: #006600 !important;
    background-color: #eeffee !important;
    border: 3px solid #006600 !important;
  }
  
  // 警告状态
  .warning {
    color: #cc6600 !important;
    background-color: #fff3cd !important;
    border: 3px solid #cc6600 !important;
  }
  
  // 信息状态
  .info {
    color: #0000cc !important;
    background-color: #e7f3ff !important;
    border: 3px solid #0000cc !important;
  }
  
  // 分隔线
  hr,
  .divider {
    border: 2px solid #000000 !important;
  }
  
  // 列表样式
  ul,
  ol {
    
    li {
      color: #000000 !important;
    }
  }
  
  // 代码块
  pre,
  code {
    background-color: #cccccc !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
  }
  
  // 模态框
  .modal {
    border: 4px solid #000000 !important;
    background-color: #ffffff !important;
    
    .modal-header {
      background-color: #cccccc !important;
      border-bottom: 3px solid #000000 !important;
    }
    
    .modal-footer {
      background-color: #cccccc !important;
      border-top: 3px solid #000000 !important;
    }
  }
  
  // 下拉菜单
  .dropdown-menu {
    background-color: #ffffff !important;
    border: 3px solid #000000 !important;
    
    .dropdown-item {
      color: #000000 !important;
      
      &:hover {
        background-color: #cccccc !important;
        color: #000000 !important;
      }
      
      &:focus {
        background-color: #ffff00 !important;
        color: #000000 !important;
      }
    }
  }
  
  // 进度条
  .progress {
    background-color: #ffffff !important;
    border: 2px solid #000000 !important;
    
    .progress-bar {
      background-color: #0000ff !important;
      border-right: 2px solid #000000 !important;
    }
  }
  
  // 标签
  .badge {
    border: 2px solid #000000 !important;
    color: #000000 !important;
    background-color: #cccccc !important;
  }
  
  // 分页
  .pagination {
    
    .page-link {
      color: #000000 !important;
      background-color: #ffffff !important;
      border: 2px solid #000000 !important;
      
      &:hover {
        background-color: #cccccc !important;
        color: #000000 !important;
        border-color: #000000 !important;
      }
      
      &:focus {
        background-color: #ffff00 !important;
        color: #000000 !important;
      }
      
      &.active {
        background-color: #0000ff !important;
        color: #ffffff !important;
        border-color: #000000 !important;
      }
    }
  }
}

@mixin reduced-motion {
  // 移除或减少动画效果
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
    
    // 移除悬停效果
    &:hover {
      transition: none !important;
    }
  }
  
  // 特别处理关键动画
  .critical-animation {
    animation-duration: 0.1s !important;
  }
}

@mixin large-text($font-size-increase: 1.2) {
  // 增加字体大小
  body {
    font-size: calc(16px * $font-size-increase) !important;
    line-height: calc(1.5 * $font-size-increase) !important;
  }
  
  // 标题字体大小调整
  h1 { font-size: calc(2em * $font-size-increase) !important; }
  h2 { font-size: calc(1.5em * $font-size-increase) !important; }
  h3 { font-size: calc(1.2em * $font-size-increase) !important; }
  h4 { font-size: calc(1em * $font-size-increase) !important; }
  h5 { font-size: calc(0.8em * $font-size-increase) !important; }
  h6 { font-size: calc(0.7em * $font-size-increase) !important; }
  
  // 按钮字体大小
  button,
  .btn {
    font-size: calc(1em * $font-size-increase) !important;
    padding: calc(0.5em * $font-size-increase) calc(1em * $font-size-increase) !important;
  }
  
  // 输入框字体大小
  input,
  select,
  textarea {
    font-size: calc(1em * $font-size-increase) !important;
    padding: calc(0.5em * $font-size-increase) calc(0.75em * $font-size-increase) !important;
  }
  
  // 表格单元格
  th,
  td {
    font-size: calc(1em * $font-size-increase) !important;
    padding: calc(0.75em * $font-size-increase) !important;
  }
  
  // 列表项
  ul li,
  ol li {
    font-size: calc(1em * $font-size-increase) !important;
    margin-bottom: calc(0.5em * $font-size-increase) !important;
  }
  
  // 图标大小
  .icon {
    font-size: calc(1.2em * $font-size-increase) !important;
  }
}

@mixin increased-line-height($line-height: 1.8) {
  // 增加行高
  body {
    line-height: $line-height !important;
  }
  
  p,
  li,
  td,
  th,
  input,
  textarea,
  select,
  button,
  .btn {
    line-height: $line-height !important;
  }
}

@mixin focus-indicator($size: 4px, $color: $primary-color) {
  // 创建自定义焦点指示器
  position: relative;
  
  &:focus-visible::after,
  &.focus-visible::after {
    content: '';
    position: absolute;
    top: -($size * 2);
    left: -($size * 2);
    right: -($size * 2);
    bottom: -($size * 2);
    border: $size solid $color;
    border-radius: calc($border-radius + $size);
    z-index: 10;
    animation: focusPulse 1.5s infinite;
    pointer-events: none;
  }
  
  @keyframes focusPulse {
    0%, 100% {
      opacity: 1;
      transform: scale(1);
    }
    50% {
      opacity: 0.7;
      transform: scale(1.05);
    }
  }
}

/* 全局无障碍样式 */
body {
  // 基础无障碍设置
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: $text-color;
  background-color: $background-color;
  
  // 确保合适的文本对比度
  color: $text-color;
  
  // 平滑滚动（可通过reduced-motion媒体查询禁用）
  scroll-behavior: smooth;
}

/* 确保所有可交互元素都有焦点样式 */
a,
button,
input,
select,
textarea,
[tabindex="0"],
[role="button"],
[role="link"],
[role="checkbox"],
[role="radio"],
[role="combobox"],
[role="listbox"],
[role="menu"],
[role="menuitem"],
[role="option"],
[role="tab"],
[role="slider"],
[role="spinbutton"],
[role="switch"] {
  @include focus-visible;
}

/* 隐藏屏幕阅读器文本 */
.sr-only,
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* 可见焦点指示器 */
.focus-visible,
:focus-visible {
  @include focus-visible;
}

/* 键盘快捷键提示 */
.keyboard-shortcut {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  margin: 0 4px;
  background-color: $surface-color;
  border: 1px solid $border-color;
  border-radius: $border-radius-small;
  font-family: monospace;
  font-size: 12px;
  font-weight: bold;
  color: $text-color;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  
  &::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    right: 1px;
    bottom: 1px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3), transparent);
    border-radius: calc($border-radius-small - 1px);
    pointer-events: none;
  }
}

/* 无障碍模态框覆盖层 */
.modal-backdrop.accessibility-aware {
  background-color: rgba(0, 0, 0, 0.5);
  
  // 为键盘用户提供更大的点击区域
  &::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
  }
}

/* 无障碍表格样式 */
.table-accessible {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  
  th,
  td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid $border-color;
  }
  
  th {
    background-color: $surface-color;
    font-weight: bold;
    color: $text-color;
    position: relative;
  }
  
  tr:nth-child(even) {
    background-color: $surface-color;
  }
  
  tr:hover {
    background-color: rgba($primary-color, 0.05);
  }
  
  // 响应式表格
  @media (max-width: $breakpoint-mobile) {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    
    &::-webkit-scrollbar {
      height: 8px;
    }
    
    &::-webkit-scrollbar-track {
      background: $surface-color;
    }
    
    &::-webkit-scrollbar-thumb {
      background: $border-color;
      border-radius: 4px;
    }
    
    &::-webkit-scrollbar-thumb:hover {
      background: $text-color-disabled;
    }
  }
}

/* 无障碍表单样式 */
.form-accessible {
  
  .form-group {
    margin-bottom: 1.5rem;
    
    label {
      display: block;
      margin-bottom: 0.5rem;
      font-weight: 500;
      color: $text-color;
    }
    
    input,
    select,
    textarea {
      width: 100%;
      padding: 0.75rem;
      border: 2px solid $border-color;
      border-radius: $border-radius;
      background-color: $background-color;
      color: $text-color;
      font-size: 1rem;
      transition: border-color 0.2s ease, box-shadow 0.2s ease;
      
      &:focus {
        outline: none;
        border-color: $primary-color;
        box-shadow: 0 0 0 3px rgba($primary-color, 0.1);
      }
      
      &:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        background-color: $surface-color;
      }
      
      &:invalid {
        border-color: $error-color;
      }
    }
    
    textarea {
      resize: vertical;
      min-height: 100px;
    }
    
    .form-help {
      display: block;
      margin-top: 0.25rem;
      font-size: 0.875rem;
      color: $text-color-secondary;
    }
    
    .form-error {
      display: block;
      margin-top: 0.25rem;
      font-size: 0.875rem;
      color: $error-color;
      font-weight: 500;
    }
  }
  
  .form-check {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    
    input[type="checkbox"],
    input[type="radio"] {
      width: auto;
      margin-right: 0.75rem;
      transform: scale(1.2);
    }
    
    label {
      margin-bottom: 0;
      cursor: pointer;
    }
  }
  
  .btn {
    @include focus-visible;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: $border-radius;
    cursor: pointer;
    transition: all 0.2s ease;
  }
}

/* 无障碍导航样式 */
.nav-accessible {
  
  ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
  }
  
  li {
    margin-right: 1rem;
    
    &:last-child {
      margin-right: 0;
    }
  }
  
  a {
    display: inline-block;
    padding: 0.75rem 1rem;
    color: $text-color;
    text-decoration: none;
    border-radius: $border-radius;
    transition: all 0.2s ease;
    
    &:hover {
      background-color: rgba($primary-color, 0.1);
      color: $primary-color;
    }
    
    &.active {
      background-color: $primary-color;
      color: white;
    }
  }
}

/* 无障碍卡片样式 */
.card-accessible {
  padding: 1.5rem;
  border: 1px solid $border-color;
  border-radius: $border-radius;
  background-color: $background-color;
  transition: all 0.2s ease;
  
  &:hover {
    border-color: $primary-color;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }
  
  &:focus-within {
    border-color: $primary-color;
    box-shadow: 0 0 0 3px rgba($primary-color, 0.2);
  }
  
  .card-header {
    margin-bottom: 1rem;
    
    h3 {
      margin: 0;
      color: $text-color;
    }
  }
  
  .card-body {
    color: $text-color;
  }
  
  .card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid $border-color;
  }
}

/* 无障碍图标样式 */
.icon-accessible {
  // 确保图标有合适的大小和颜色
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: $text-color;
  
  // 为纯图标按钮提供无障碍标签
  &.icon-only {
    min-width: 40px;
    height: 40px;
    padding: 0;
    border-radius: $border-radius;
    
    &:hover {
      background-color: rgba($primary-color, 0.1);
    }
  }
  
  // 带文本的图标
  &.with-text {
    margin-right: 0.5rem;
  }
}

/* 无障碍警告和提示 */
.alert-accessible {
  padding: 1rem;
  border-radius: $border-radius;
  border-left: 4px solid transparent;
  margin-bottom: 1.5rem;
  
  &.alert-success {
    background-color: rgba($success-color, 0.1);
    border-left-color: $success-color;
    color: $success-color;
  }
  
  &.alert-error {
    background-color: rgba($error-color, 0.1);
    border-left-color: $error-color;
    color: $error-color;
  }
  
  &.alert-warning {
    background-color: rgba($warning-color, 0.1);
    border-left-color: $warning-color;
    color: $warning-color;
  }
  
  &.alert-info {
    background-color: rgba($info-color, 0.1);
    border-left-color: $info-color;
    color: $info-color;
  }
}

/* 无障碍工具提示 */
.tooltip-accessible {
  position: relative;
  display: inline-block;
  cursor: help;
  
  &::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: $text-color;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: $border-radius;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    font-size: 0.875rem;
    max-width: 300px;
    white-space: normal;
    text-align: center;
  }
  
  &::before {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: $text-color;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
  }
  
  &:hover::after,
  &:hover::before,
  &:focus::after,
  &:focus::before {
    opacity: 1;
    visibility: visible;
  }
}

/* 无障碍进度指示器 */
.progress-accessible {
  width: 100%;
  height: 8px;
  background-color: $surface-color;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  
  .progress-bar {
    height: 100%;
    background-color: $primary-color;
    border-radius: 4px;
    transition: width 0.3s ease;
    
    // 增加可见性的动画
    @keyframes progressShine {
      0% {
        background-position: -200% 0;
      }
      100% {
        background-position: 200% 0;
      }
    }
    
    &::after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
      );
      animation: progressShine 2s infinite;
      pointer-events: none;
    }
  }
  
  // 进度文本
  .progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: bold;
    color: $text-color;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
  }
}

/* 无障碍评分组件 */
.rating-accessible {
  display: inline-flex;
  
  .rating-item {
    cursor: pointer;
    color: $border-color;
    font-size: 1.5rem;
    transition: color 0.2s ease;
    margin-right: 0.25rem;
    
    &:last-child {
      margin-right: 0;
    }
    
    &:hover,
    &:focus,
    &.active {
      color: $warning-color;
    }
    
    &:focus {
      outline: none;
      @include focus-visible($outline-color: $warning-color);
    }
  }
}

/* 无障碍标签页组件 */
.tabs-accessible {
  
  .tabs-nav {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    border-bottom: 2px solid $border-color;
  }
  
  .tab-item {
    padding: 0.75rem 1.5rem;
    border: 2px solid transparent;
    border-bottom: none;
    background-color: transparent;
    color: $text-color;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: $border-radius $border-radius 0 0;
    margin-right: 0.5rem;
    
    &:hover {
      background-color: rgba($primary-color, 0.1);
      color: $primary-color;
    }
    
    &:focus {
      outline: none;
      @include focus-visible;
    }
    
    &.active {
      background-color: $background-color;
      color: $primary-color;
      border-color: $primary-color;
      border-bottom-color: $background-color;
      margin-bottom: -2px;
    }
  }
  
  .tab-panel {
    display: none;
    padding: 1.5rem;
    border: 2px solid $border-color;
    border-radius: 0 $border-radius $border-radius $border-radius;
    background-color: $background-color;
    
    &.active {
      display: block;
    }
  }
}

/* 无障碍下拉菜单 */
.dropdown-accessible {
  position: relative;
  display: inline-block;
  
  .dropdown-toggle {
    @include focus-visible;
    padding: 0.75rem 1.5rem;
    border: 2px solid $border-color;
    border-radius: $border-radius;
    background-color: $background-color;
    color: $text-color;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 150px;
    
    &:hover {
      border-color: $primary-color;
      color: $primary-color;
    }
    
    &:focus {
      border-color: $primary-color;
    }
    
    &.active {
      border-color: $primary-color;
      color: $primary-color;
    }
    
    .dropdown-icon {
      margin-left: 0.5rem;
      transition: transform 0.2s ease;
      
      &.rotated {
        transform: rotate(180deg);
      }
    }
  }
  
  .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    min-width: 100%;
    padding: 0.5rem 0;
    margin-top: 0.25rem;
    font-size: 1rem;
    color: $text-color;
    background-color: $background-color;
    border: 2px solid $border-color;
    border-radius: $border-radius;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    
    &.active {
      display: block;
    }
  }
  
  .dropdown-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1.5rem;
    clear: both;
    font-weight: 400;
    color: $text-color;
    text-align: left;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    
    &:hover,
    &:focus {
      background-color: rgba($primary-color, 0.1);
      color: $primary-color;
    }
    
    &:focus {
      outline: none;
      @include focus-visible;
    }
    
    &.active {
      background-color: $primary-color;
      color: white;
    }
  }
}

/* 无障碍开关组件 */
.switch-accessible {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
  
  input {
    opacity: 0;
    width: 0;
    height: 0;
  }
  
  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: $border-color;
    transition: 0.4s;
    border-radius: 34px;
    
    &::before {
      position: absolute;
      content: "";
      height: 26px;
      width: 26px;
      left: 4px;
      bottom: 4px;
      background-color: white;
      transition: 0.4s;
      border-radius: 50%;
    }
  }
  
  input:checked + .slider {
    background-color: $primary-color;
  }
  
  input:focus + .slider {
    @include focus-visible($outline-color: $primary-color, $outline-width: 2px);
  }
  
  input:checked + .slider::before {
    transform: translateX(26px);
  }
  
  // 无障碍标签
  .switch-label {
    display: inline-flex;
    align-items: center;
    margin-left: 0.75rem;
    cursor: pointer;
    font-weight: 500;
  }
}

/* 无障碍媒体查询 */
@media (prefers-reduced-motion: reduce) {
  body {
    @include reduced-motion;
  }
  
  // 移除特定动画
  .animate,
  .animated,
  [class*="animate-"],
  [class*="animated-"] {
    animation: none !important;
    transition: none !important;
  }
}

@media (prefers-contrast: high) {
  body.high-contrast {
    @include high-contrast;
  }
}

@media (prefers-color-scheme: dark) {
  body.dark-mode {
    color: #ffffff;
    background-color: #121212;
    
    // 覆盖主题颜色
    --text-color: #ffffff;
    --text-color-secondary: #b0b0b0;
    --text-color-disabled: #808080;
    --background-color: #121212;
    --surface-color: #1e1e1e;
    --border-color: #404040;
    --primary-color: #90caf9;
    --secondary-color: #ce93d8;
    --success-color: #81c784;
    --warning-color: #ffb74d;
    --error-color: #e57373;
    --info-color: #64b5f6;
  }
  
  // 黑暗模式下的高对比度
  body.dark-mode.high-contrast {
    color: #ffffff;
    background-color: #000000;
    
    a {
      color: #00ffff !important;
    }
    
    button,
    .btn {
      background-color: #333333 !important;
      color: #ffffff !important;
    }
    
    input,
    select,
    textarea {
      background-color: #000000 !important;
      color: #ffffff !important;
    }
  }
}

/* 打印样式 */
@media print {
  // 确保打印时的可访问性
  body {
    color: #000000 !important;
    background-color: #ffffff !important;
    font-size: 12pt;
    line-height: 1.4;
  }
  
  // 移除不必要的元素
  .no-print {
    display: none !important;
  }
  
  // 确保链接在打印时可见
  a {
    color: #000000 !important;
    text-decoration: underline !important;
    
    &::after {
      content: " (" attr(href) ")";
      font-size: 0.9em;
      color: #666666;
    }
  }
  
  // 确保表单元素可见
  input,
  select,
  textarea {
    border: 1px solid #000000 !important;
    background-color: #ffffff !important;
    color: #000000 !important;
  }
  
  // 确保表格在打印时正确显示
  table {
    border-collapse: collapse !important;
    width: 100% !important;
  }
  
  th,
  td {
    border: 1px solid #000000 !important;
    padding: 0.5rem !important;
  }
}

/* 响应式无障碍调整 */
@media (max-width: $breakpoint-mobile) {
  // 移动设备上增加触摸目标大小
  a,
  button,
  input[type="button"],
  input[type="submit"],
  input[type="reset"],
  [role="button"] {
    min-height: 48px;
    min-width: 48px;
    padding: 0.75rem;
  }
  
  // 移动设备上增大字体大小
  body {
    font-size: 18px;
  }
  
  // 简化移动设备上的导航
  .nav-accessible ul {
    flex-direction: column;
  }
  
  .nav-accessible li {
    margin-right: 0;
    margin-bottom: 0.5rem;
    
    &:last-child {
      margin-bottom: 0;
    }
  }
  
  .nav-accessible a {
    display: block;
    width: 100%;
    text-align: center;
  }
}

/* 无障碍焦点样式的自定义动画 */
@keyframes focusRing {
  0% {
    box-shadow: 0 0 0 0 rgba($primary-color, 0.7);
  }
  50% {
    box-shadow: 0 0 0 8px rgba($primary-color, 0.3);
  }
  100% {
    box-shadow: 0 0 0 0 rgba($primary-color, 0);
  }
}

.focus-animation:focus {
  outline: 2px solid $primary-color;
  animation: focusRing 1.5s infinite;
}

/* 无障碍跳过导航链接 */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background-color: $primary-color;
  color: white;
  padding: 1rem 1.5rem;
  font-weight: bold;
  text-decoration: none;
  z-index: 9999;
  transition: top 0.2s ease;
  
  &:focus {
    top: 0;
    outline: none;
  }
}

/* 无障碍加载指示器 */
.loader-accessible {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid $surface-color;
  border-radius: 50%;
  border-top-color: $primary-color;
  animation: spin 1s ease-in-out infinite;
  
  // 无障碍标签
  &::after {
    content: attr(data-loading-text) "...";
    display: block;
    margin-top: 10px;
    text-align: center;
    font-size: 0.875rem;
    color: $text-color-secondary;
    animation: none;
    width: auto;
    height: auto;
    border: none;
    border-radius: 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 无障碍滚动指示器 */
.scroll-indicator {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background-color: $primary-color;
  z-index: 9999;
  transition: width 0.1s ease;
}

/* 无障碍阅读模式 */
.reading-mode {
  // 移除不必要的元素
  .no-reading-mode {
    display: none !important;
  }
  
  // 简化布局
  .container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
  }
  
  // 优化阅读体验
  body {
    background-color: #f8f8f8 !important;
    color: #333333 !important;
    font-size: 18px;
    line-height: 1.8;
  }
  
  // 优化标题样式
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    color: #000000 !important;
    margin-top: 2rem;
    margin-bottom: 1rem;
  }
  
  // 优化段落样式
  p {
    margin-bottom: 1.5rem;
    text-align: justify;
    hyphens: auto;
  }
  
  // 优化图片样式
  img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2rem auto;
  }
  
  // 优化链接样式
  a {
    color: #0066cc !important;
    text-decoration: underline;
  }
}